using System;
using System.Collections.Generic;
using System.Text;
using QLNT_DTO;
using System.Data;

namespace QLNT_DAO
{
    public class Quyen_dao
    {
        public Quyen_dto[] SelectAll()
        {
            Quyen_dto[] tk = new Quyen_dto[100];
            DataTable dt = new DataTable();
            try
            {
                dt = MyExecute.ExecuteQuery("sp_LayDSQuyen");
                int n = dt.Rows.Count;
                tk = new Quyen_dto[n];
                for (int i = 0; i < n; i++)
                {
                    tk[i] = new Quyen_dto();
                    tk[i].TenQuyen = dt.Rows[i]["TenQuyen"].ToString();
                    tk[i].MaQuyen = int.Parse(dt.Rows[i]["MaQuyen"].ToString());
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return tk;
        }

    }
}
